#!/bin/bash
#模拟网闸同步
set -ex

curr_path=`pwd`

if [ "$curr_path" != '/home/vsftp' ]
then
    echo "请在/home/vsftpd目录下执行此脚本"
    exit 0
fi

source_dir="out_in_write_1"
target_dir="in_out_read_1"

while [ 1=1 ]
do
    if [ -d "$source_dir" -a -d "$target_dir" ]
    then
      mv "$source_dir"/* "$target_dir"/ 2>>/dev/null
      sleep 5
    else
        echo "源目录或目标目录不存在"
    fi
done